<#-- 导入模版定义文件-->
<#include "../template/template_editPage.ftl">
<@edit title="消息管理">
<style>
	.custom-width{width:auto!important}
	.input table.custom-table tr td{border:0;}
	.custom-add{border:1px solid #ebebeb;display:none;padding:0px 10px;}
	.cus-add-a{color:#FF6600;cursor:pointer;}
</style>

<body class="input">
<script type="text/javascript">
	$().ready( function() {
	
		var $validateErrorContainer = $("#validateErrorContainer");
		var $validateErrorLabelContainer = $("#validateErrorContainer ul");
		var $validateForm = $("#inputForm");
		var $tab = $("#tab");
	
		// Tab效果
		$tab.tabs(".tabContent", {
			tabs: "input"
		});
		
		// 表单验证
		$validateForm.validate({
			errorContainer: $validateErrorContainer,
			errorLabelContainer: $validateErrorLabelContainer,
			wrapper: "li",
			errorClass: "validateError",
			ignoreTitle: true,
			rules: {
				"messageInfo.messageTitle": {
						required: true,
						 maxlength:50
				},
				"messageInfo.messageContent": {
						required: true,
						maxlength:200
				},
				"messageInfo.messageType": {
						required: true
				}
			},
			messages: {
				"messageInfo.messageTitle": {
						required: "请填写消息标题",
						maxlength: "消息标题50字符之内"
				},
				"messageInfo.messageContent": {
						required: "请填写消息内容",
						maxlength: "消息内容200字符之内"
				},
				"messageInfo.messageType": {
						required: "发送类型不能为空"
				}
			},
			submitHandler: function(form) {
				$(form).find(":submit").attr("disabled", true);
				form.submit();
			}
		});
		<#if actionErrors??&&(actionErrors?size > 0)>
			$.dialog({type: "warn", content: "<#list actionErrors as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 3000});
		</#if>
		
	});
	
	</script>
	<div class="body">
		<div class="inputBar">
			<h1><span class="icon">&nbsp;</span>发送消息</h1>
		</div>
		<div style="display: none;" id="validateErrorContainer" class="validateErrorContainer">
			<div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
				<ul></ul>
			</div>
		</div>		
		<form id="inputForm" class="validate" action="${web_base}/go/message!save.htm" method="post">
			<table class="inputTable tabContent">

				<tr>
					<th>
						消息标题：
					</th>
					<td>
					  <input type="text" name="messageInfo.messageTitle" class="formText {required: true}" value=""/>
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						消息内容：
					</th>
					<td>
					  <textarea rows="8" cols="60" name="messageInfo.messageContent" class="formText {required: true}" ></textarea>
					  <label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						目标客户：
					</th>
					<td>
						<table class="custom-table">
							<tr>
								<td height="35"><input type="radio" id="sendCustomerType" name="messageInfo.messageType" class="formText {required: true} custom-width" value="1"/></td>
								<td>全体客户</td>
							</tr>
							<tr>
								<td><input type="radio" id="sendCustomerType" name="messageInfo.messageType" class="formText {required: true} custom-width" value="0"/></td>
								<td>单个客户  &nbsp;&nbsp;&nbsp;<input type="text" id="customerId" name="customerId"  value="输入客户号" onclick="JavaScript:this.value=''" /></td>
							</tr>
							<tr>
								<td><input type="radio" id="sendCustomerType" name="messageInfo.messageType" class="formText {required: true} custom-width" value="2"/></td>
								<td>邀请码客户  <input type="text" id="invitationCode" name="invitationCode" value="输入客户邀请码" onclick="JavaScript:this.value=''"/></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			<div class="buttonArea">
				<input type="submit" class="formButton" value="发   送" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
			</div>
		</form>
	</div>
</body>
</@edit>